<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Element对象</title>
</head>
<body>
<a>点我试一试</a>
<input type="button" id="btn_set" value="设置属性">
<input type="button" id="btn_remove" value="删除属性">

</body>
</html>
<script>
    //设置属性练习
    var bet_set = document.getElementById("btn_set");
    bet_set.onclick = function () {
        var Element_a = document.getElementsByTagName("a")[0];
        //Element_a.setAttribute("href","http://ntlias-stu.boxuegu.com");
        Element_a.href = "href\",\"https://gitee.com/zhang_he_qiang";
    }

    //删除属性练习
    var btn_remove = document.getElementById("btn_remove");
    btn_remove.onclick = function () {
        var element_a = document.getElementsByTagName("a")[0];
        element_a.removeAttribute("href")
    }

</script>